//
//  YiBaoDuanXinYanZhengViewController.m
//  EJLX
//
//  Created by xufei on 15/12/1.
//  Copyright © 2015年 江苏一键联信息科技有限公司. All rights reserved.
//

#import "YiBaoDuanXinYanZhengViewController.h"
#import "HttpsManager.h"
#import "duanXinYanZheng.h"
@interface YiBaoDuanXinYanZhengViewController ()

@end

@implementation YiBaoDuanXinYanZhengViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    UIView*view=[[UIView alloc]initWithFrame:CGRectMake(0, 20,WIDE, 44)];
    view.backgroundColor=RGB_COLOR(0x00c49f);
    
    [self.view addSubview:view];
    UILabel*label=[[UILabel alloc]initWithFrame:CGRectMake(WIDE/2-75, 10,150, 24)];
    label.text=@"验证码确认";
    label.textColor=[UIColor whiteColor];
    label.textAlignment=NSTextAlignmentCenter;
    [view addSubview:label];
    UIButton*but1=[[UIButton alloc]initWithFrame:CGRectMake(10,7,30,30)];
    [but1 setImage:[UIImage imageNamed:@"返回箭头"] forState:UIControlStateNormal];
    [but1 addTarget:self action:@selector(butClick) forControlEvents:UIControlEventTouchUpInside];
    [view addSubview:but1];
    
    UILabel*bigLabel=[[UILabel alloc]initWithFrame:CGRectMake(0, 64, WIDE, 100)];
    bigLabel.text=@"尊敬的用户您好，为了保护您的资金安全，本次操作需要验证码，请在收到短信后，正确填写，然后提交";
    bigLabel.textColor=[UIColor blackColor];
    bigLabel.numberOfLines=0;
    [self.view addSubview:bigLabel];
    field=[[UITextField alloc]initWithFrame:CGRectMake(5, 200, WIDE-100, 40)];
    field.placeholder=@"短信验证码";
    [self.view addSubview:field];
    UIButton*but=[[UIButton alloc]initWithFrame:CGRectMake(WIDE-100+10, 200, 80, 40)];
    // [but setImage:[UIImage imageNamed:@"获取验证码"] forState:ui]
    
    [but setImage:[UIImage imageNamed:@"获取验证码" ] forState:UIControlStateNormal];
    [but addTarget:self action:@selector(smellButClick) forControlEvents:UIControlEventTouchUpInside];
    
    [self.view addSubview:but];
    UIButton*bigBut=[[UIButton alloc]initWithFrame:CGRectMake(20, 64+100+40+20+20+10, WIDE-40, 40)];
    bigBut.backgroundColor=RGB_COLOR(0x00c49f);
    [bigBut setTitle:@"完成支付" forState:UIControlStateNormal];
    [bigBut setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [bigBut addTarget:self action:@selector(bigButClick) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:bigBut];
    
}
-(void)bigButClick
{
    duanXinYanZheng*VC=[[duanXinYanZheng alloc]init];
    VC.captcha=field.text;
    VC.paymentId=_paymentId;
   // [HttpsManager registerDuanXinYanZheng:<#(duanXinYanZheng *)#> completion:<#^(int paycode, NSString *paymsg)completion#>];
    [HttpsManager registerDuanXinYanZheng:VC completion:^(int paycode, NSString *paymsg)
    {
        SHOW_ALERT(paymsg)
    }];
    
    
    
}
-(void)butClick
{
    [self.navigationController popViewControllerAnimated:YES];
}
-(void)smellButClick
{

    duanXinYanZheng*vc=[[duanXinYanZheng alloc]init];
    vc.captcha=field.text;
    [HttpsManager requestGetZhiFuYanZhengMa:vc completion:^(int errcode, NSString *errmsg)
    {
        SHOW_ALERT(errmsg);
    }];
    
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
